/* webpack 5.*的话，下面代码，webpack打包执行会报错
---------------------------------------------------------------- */
// import $ from 'jquery'
// console.log($)

/* func: sum
---------------------------------------------------------------- */
function sum(...args) {
  return args.reduce((p, c) => p + c, 0)
}

console.log(sum(1, 2, 3, 4))

/* es6 模块化
---------------------------------------------------------------- */
// import { multiply } from './test'
// eslint-disable-next-line
// console.log(multiply(1, 5))

/* res
---------------------------------------------------------------- */
// import('./test')
//   .then((res) => {
//     console.log(res)
//   })
//   .catch((error) => console.log(error))

/* {multiply}；官方建议用module.multiply方式
---------------------------------------------------------------- */
// import('./test')
//   .then(({multiply}) => {
//     console.log(multiply(1, 5))
//   })
//   .catch((error) => console.log(error))

import(/* webpackChunkName: "test" */ './test')
.then((module) => console.log(module.multiply(1, 5)))
.catch((error) => console.log(error))

